<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:83:"D:\phpstudy_pro\WWW\FAST\shopping\public/../application/index\view\index\index.html";i:1608813524;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>首页</title>
    <link rel="shortcut icon" href="/assets/img/favicon.ico" />
    <!-- Bootstrap Core CSS -->
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="/assets/css/index.css" rel="stylesheet">

    <!-- Plugin CSS -->
    <link href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/simple-line-icons/2.4.1/css/simple-line-icons.min.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link href="/assets/layui/css/layui.css" rel="stylesheet">
    <script src="/assets/layui/layui.js"></script>
    <style>
        .nav-item {
            width: 20%;
            float: left;
            text-align: center;
            margin-top: 50px;
            cursor:pointer;
        }
        .nav-img {
            width: 90px;
            height: 90px;
            border-radius: 10px;
        }
        .goods-container{
            width: 100%;
            margin-top: 50px;
        }
        .goods-item {
            width: 25%;
            float: left;
            margin-top: 50px;
            height: 350px;
            text-align: center;
            cursor:pointer;
            border-radius: 5px;
        }
        .goods-img {
            width: 300px;
            height: 200px;
            margin-top: 1px;
        }
        .goods-info {
            color: gray;
            font-size: 13px;
        }
        .goods-title {
            margin-top: 5px; width: 80%; margin-left: 10%;
        }
        .web-info {
            width: 100%;
            background-color: whitesmoke;
            height: 200px;
            line-height: 200px;
            text-align: center;
            margin-top: 30px;
        }
        .search-box {
            display: flex;
            flex-direction: row;
            justify-content: center;
            width: 50%;
            margin:80px auto 0;
        }
        .search-input {
            border: 2px solid red;
        }
    </style>
</head>

<body id="page-top">

<nav id="mainNav" class="navbar navbar-default navbar-fixed-top" style="background-color: orange; ">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-menu">
                <span class="sr-only">Toggle navigation</span><i class="fa fa-bars"></i>
            </button>
            <a class="navbar-brand page-scroll" href="#page-top">GAL商城</a>
        </div>

        <div class="collapse navbar-collapse" id="navbar-collapse-menu">
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a href="" style="color:#fff"><i class="fa fa-cart-arrow-down"> </i> 购物车<span class="layui-badge">9</span></a>
                </li>
                <li><a href="/index/index/login.html">登录/注册</a></li>
            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container-fluid -->
</nav>

<form class="search-box" action="<?php echo url('index/index'); ?>" method="get">
    <input type="text" name="goods_name" class="layui-input search-input">
    <input type="submit" value="搜索" class="layui-btn layui-btn-normal layui-btn-danger">
</form>

<div class="layui-carousel" id="banner" style="margin-top: 30px;">
    <div carousel-item>
        <?php if(is_array($banner) || $banner instanceof \think\Collection || $banner instanceof \think\Paginator): if( count($banner)==0 ) : echo "" ;else: foreach($banner as $key=>$vo): ?>
        <div>
            <a href="<?php echo $vo['url']; ?>" target="_blank">
                <img src="<?php echo $vo['image']; ?>" style="width: 100%;height: 400px;">
            </a>
        </div>
        <?php endforeach; endif; else: echo "" ;endif; ?>
    </div>
</div>

<div style="width: 100%;margin-top: 30px;">
    <?php if(is_array($goodscate) || $goodscate instanceof \think\Collection || $goodscate instanceof \think\Paginator): if( count($goodscate)==0 ) : echo "" ;else: foreach($goodscate as $key=>$vo): ?>
    <div class="nav-item">
        <img src="<?php echo $vo['image']; ?>" class="nav-img">
        <p><?php echo $vo['name']; ?></p>
    </div>
    <?php endforeach; endif; else: echo "" ;endif; ?>
</div>

<div style="clear: both;"></div>
<div class="goods-container">
    <?php if(is_array($goods) || $goods instanceof \think\Collection || $goods instanceof \think\Paginator): if( count($goods)==0 ) : echo "" ;else: foreach($goods as $key=>$vo): ?>
    <div class="goods-item">
        <img src="<?php echo $vo['image']; ?>" class="goods-img">
        <p class="goods-title"><?php echo $vo['title']; ?></p>
        <p style="margin-top: 5px;">
            <span style="color: red;font-size: 18px;font-weight: bold;">¥<?php echo $vo['price']; ?></span>
            <span class="goods-info"><?php echo $vo['sell_num']; ?> 人已买</span>
        </p>
        <p style="margin-top: 5px;">
            <span class="goods-info">分类:<?php echo $vo['goods_name']; ?></span>
            <span class="goods-info">月销 <?php echo $vo['sell_num']; ?> 件</span>
        </p>
        <p style="margin-top: 10px;">
            <button class="layui-btn layui-bg-red">加入购物车</button>
            <a href="<?php echo url('member/buy'); ?>?gid=<?php echo $vo['id']; ?>" class="layui-btn layui-bg-red">立即购买</a>
        </p>
    </div>
    <?php endforeach; endif; else: echo "" ;endif; ?>
</div>
<div style="clear: both;"></div>
<div style="text-align: center;margin-top: 50px;"><?php echo $page; ?></div>
<div class="web-info">
    2020 © http://shop.open.com.cn/
</div>

<!-- jQuery -->
<script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
    layui.use(['carousel', 'jquery', 'element'], function () {
        var carousel = layui.carousel;
        var $ = layui.$;
        var element = layui.element;
        carousel.render({
            elem: "#banner",
            width: '100%',
            height: '400px'
        });
    });
    // 鼠标经过添加阴影
    // $(function () {
    //     $('.goods-img').mouseover(function () {
    //         $(this).addClass('layui-anim layui-anim-scale');
    //     });
    //     $('.goods-img').mouseout(function () {
    //         $(this).removeClass('layui-anim layui-anim-scale');
    //     });
    // })
</script>
<script>
    // 页面刷新后，保留上次浏览的位置
    function window.onbeforeunload(){
        var scrollPos;
        if (typeof window.pageYOffset != 'undefined') {
            scrollPos = window.pageYOffset;
        }
        else if (typeof document.compatMode != 'undefined' &&
            document.compatMode != 'BackCompat') {
            scrollPos = document.documentElement.scrollTop;
        }
        else if (typeof document.body != 'undefined') {
            scrollPos = document.body.scrollTop;
        }
        document.cookie="scrollTop="+scrollPos; //存储滚动条位置到cookies中
    }
    function window.onload()
    {
        if(document.cookie.match(/scrollTop=([^;]+)(;|$)/)!=null){
            var arr=document.cookie.match(/scrollTop=([^;]+)(;|$)/); //cookies中不为空，则读取滚动条位置
            document.documentElement.scrollTop=parseInt(arr[1]);
            document.body.scrollTop=parseInt(arr[1]);
        }
    }
</script>
</body>

</html>